using System;
using System.Collections.Generic;
using System.Text;

namespace WebCrawlerTools
{
    public class PNextRule
    {
        private int start = 0;
        private int end = 0;
        private int step = 1;
        private int current = 0;
        private int size = 0;

        public PNextRule(int start, int end, int step)
        {
            this.start = start;
            this.end = end;
            this.step = step;
            this.current = start;
        }

        public PNextRule()
        {
            
        }

        public int Start
        {
            get
            {
                return start;
            }
            set
            {
                start = value;
            }
        }

        public int End
        {
            get
            {
                return end;
            }
            set
            {
                end = value;
            }
        }

        public int Step
        {
            get
            {
                return step;
            }
            set
            {
                step = value;
            }
        }

        public int Current
        {
            get
            {
                return current;
            }
            set
            {
                current = value;
            }
        }

        public int Size
        {
            get
            {
                return size;
            }
            set
            {
                size = value;
            }
        }

        public String getNextVal()
        {
            current += step;
            if (current > end)
                return "";
            else
            {
                String format = "{0}";
                if (size != 0)
                {
                    format = "{0:D" + size + "}";
                }
                return String.Format(format, current);
            }
        }
    }
}
